//
//  SQBaseNormalViewController.m
//  pai
//
//  Created by pro on 14-11-5.
//  Copyright (c) 2014年 linjunjing. All rights reserved.
//

#import "SQBaseNormalViewController.h"
#import "Global.h"

@interface SQBaseNormalViewController ()

@end

@implementation SQBaseNormalViewController
@synthesize MyNavigationBar;
@synthesize MyNavigationItem;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    if (IOS7) {
        self.MyNavigationBar = [[UIView alloc] initWithFrame:CGRectMake(0, 20, 320, 44)];
    }else{
        self.MyNavigationBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    }
    [self.MyNavigationBar setBackgroundColor:[UIColor colorWithRed:25/255.0 green:159/255.0 blue:229/255.0 alpha:1.00]];
    [self.view addSubview:self.MyNavigationBar];
    //返回按钮
    UIButton* backbutton = [[UIButton alloc]initWithFrame:CGRectMake(11, 5, 105/2, 65/2)];
    [backbutton setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [backbutton addTarget:self action:@selector(onActionBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.MyNavigationBar addSubview:backbutton];
    
    //标题栏
    self.MyNavigationItem = [[UILabel alloc]initWithFrame:CGRectMake(60, 0, 200, 44)];
    [self.MyNavigationItem setFont:[UIFont boldSystemFontOfSize:20]];
    [self.MyNavigationItem setTextColor:[UIColor whiteColor]];
    [self.MyNavigationItem setTextAlignment:NSTextAlignmentCenter];
    [self.MyNavigationBar addSubview:self.MyNavigationItem];
    
    self.navigationItem.hidesBackButton = YES;
}

-(void)setTitle:(NSString *)title
{
    [self.MyNavigationItem setText:title];
}
-(void)onActionBack:(UIButton*)button
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
